<template>
  <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="90px">
    <el-form-item label="器具编码" prop="containerCode">
      <el-input
        v-model="queryParams.containerCode"
        placeholder="请输入器具编码"
        clearable
        size="small"
        @keyup.enter.native="handleSearch"
      />
    </el-form-item>
    <el-form-item label="器具型号" prop="materialCode">
      <el-input
        v-model="queryParams.materialCode"
        placeholder="请输入器具型号编码"
        clearable
        size="small"
        @keyup.enter.native="handleSearch"
      />
    </el-form-item>
    <el-form-item label="当前仓库" prop="currentWarehouseId">
      <el-select v-model="queryParams.currentWarehouseId" placeholder="请选择当前仓库" clearable size="small">
        <el-option
          v-for="warehouse in warehouseList"
          :key="warehouse.warehouseId"
          :label="warehouse.warehouseName"
          :value="warehouse.warehouseId"
        />
      </el-select>
    </el-form-item>
    <el-form-item label="位置状态" prop="locationStatus">
      <el-select v-model="queryParams.locationStatus" placeholder="请选择位置状态" clearable size="small">
        <el-option label="在库" value="1" />
        <el-option label="在途" value="2" />
      </el-select>
    </el-form-item>
    <el-form-item label="业务状态" prop="businessStatus">
      <el-select v-model="queryParams.businessStatus" placeholder="请选择业务状态" clearable size="small">
        <el-option label="正常" value="1" />
        <el-option label="封存" value="2" />
        <el-option label="维修" value="3" />
        <el-option label="报废" value="4" />
      </el-select>
    </el-form-item>
    <el-form-item label="装箱状态" prop="packingStatus">
      <el-select v-model="queryParams.packingStatus" placeholder="请选择装箱状态" clearable size="small">
        <el-option label="空箱" value="1" />
        <el-option label="满箱" value="2" />
      </el-select>
    </el-form-item>
    <el-form-item label="当前项目" prop="currentProjectId">
      <el-select v-model="queryParams.currentProjectId" placeholder="请选择当前项目" clearable size="small">
        <el-option
          v-for="project in projectList"
          :key="project.projectId"
          :label="project.projectName"
          :value="project.projectId"
        />
      </el-select>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSearch">搜索</el-button>
      <el-button icon="el-icon-refresh" size="mini" @click="handleReset">重置</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
export default {
  name: 'ContainerSearchForm',
  props: {
    queryParams: {
      type: Object,
      required: true
    },
    warehouseList: {
      type: Array,
      default: () => []
    },
    projectList: {
      type: Array,
      default: () => []
    }
  },
  methods: {
    /** 搜索按钮操作 */
    handleSearch() {
      this.$emit('search')
    },
    /** 重置按钮操作 */
    handleReset() {
      this.resetForm('queryForm')
      this.$emit('reset')
    }
  }
}
</script>
